perf(codegen): entry resolution reaches Any-typed callback params — __commonJS-shape calls 7.4 → 4.5 ns (typed parity) - #9109
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe codegen now resolves eligible untyped or ChangesCallee resolution
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This narrowly broadens a callback-call optimization while preserving existing behavior for unresolved or non-function values. No actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description provides detailed change scope, behavior, benchmarks, semantics, and test results. It does not use the template headings or include the checklist, but the required information is mostly present, including references to related issues and test verification.
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
7babd8e to
fff0166
Compare
|
Merged, after resolving a conflict against main — details at the end. The reasoning that makes this safe is the sentence in the second hunk:
That's the right framing. Widening entry to an So the thing worth testing is what happens when an
Cases 5–11 are the ones that would misdispatch if the guarded arm's fallback were hint-dependent; all six throw exactly as node does. 17 is the polymorphic-reassignment case. The conflict, and why it mattered. The branch didn't merge cleanly against main: #9105 had added an early Worth flagging how that first presented: my initial I also removed five Validation: codegen 1347 passed, runtime 2819 ( |
What
Entry resolution (#9071) reaches
Any-typed callback parameters — theesbuild
__commonJS/__esmfactory shape, where every module-init callbackerases to
Anyand paid the fulljs_closure_callNdispatcher per call:emit_callee_binding_resolutionsadmits a PARAMETERwhose hint is absent or
Any(a binding hinted as somethingnon-function stays out — its resolution could only return null);
early_branches.rsaccepts a callee with aresolved-target map entry even when the
Functionhint is missing — thearm's runtime behavior (checked unbox, null-guarded direct diamond, full
dispatcher fallback) was always hint-independent; the hint only selected
who enters.
A resolution over a non-closure value (a number,
undefined, a boundfunction, a generator) returns null at entry and every call keeps the exact
dispatcher path.
Numbers
Single-shape 50M-call probes, quiet Linux, same-build
PERRY_CALLEE_BINDING_RESOLUTION=0A/B:Any-param callback loop (__commonJSshape)Any-param, conditionally calledThe
Anyshape reaches exact parity with the typed shape. This is the"partial until the param-hint gate lifts" band flagged in #9105 and in the
claude-code startup profile split — the cc
--helpre-profile is gated onthis PR landing (plus #9105 and the #9106 fix).
Semantics
Differential vs node identical: non-function/
undefinedthrough theAnyparam (TypeError at the call), the param REASSIGNED mid-body (collector
excludes; the new value is observed), bound functions and ordinary functions
(
this === undefined) through theAnyparam, arity-mismatch and restarrows, capture mutation between calls, generator functions. Kill-switch build
output-identical; the #9105 corpora re-run clean (the one diff is the
documented pre-existing no-TDZ-for-globals
TypeErrorvsReferenceErrorline, gate-independent).
Testing
RUSTFLAGS=-D warnings cargo check(host excludes) — clean;perry-codegen1830/0 — green.perry-runtime --lib: 1804 tests pass, then the suite ABORTS atobject::reserved_floor::…::user_properties_read_back_through_the_get_path_at_scale(
shapes.rs:1539ShapeId/ObjectHeader disagreement, double panic) — a mainregression filed as regression(main): shapes.rs ShapeId/ObjectHeader disagreement aborts the entire perry-runtime test suite (SIGABRT, ~1000 tests masked) #9108 that masks the suite tail for every branch;
this PR contains no
perry-runtimefiles.issue_8690/issue_8773carry one pre-existing failure each on current main(regression(main): wolf-ecs-shaped nested subclass loops lost their versioned fast clones (packed-guard sites 3 → 0) #9106, the versioned-loop-clone regression — window
8b40634abd..f3f405271c, owned by the claudecode session), identical onbase and branch.
Summary by CodeRabbit